<%-- 
    Document   : center
    Created on : Oct 4, 2011, 8:34:30 PM
    Author     : linh
--%>

<%@page import="MODEL.POJO.ChiTietSanPhamPOJO"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <script src="js/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $('#main_phim1>div').each(function(){
                    var $img=$(this).children().attr('src');
                    //alert($img)
                    var $title=$(this).find('p.name').text()
                    //alert($title)
                    $(this).find('div.info').prepend('<img src='+$img+' /><p class="title">'+$title+'</p>')
                })
                $('#main_phim1>div>img').hover(function(){
                    $(this).parent().find('div.info').show()
                },function(){
                    $(this).parent().find('div.info').hide()
                }).mousemove(function(e){
                    var $X=e.clientX
                    var $Y=e.clientY
                    $(this).parent().find('div.info').css({'left':$X+20,'top':$Y})
                }).click(function(){
                    var $link=$(this).parent().find('a').attr('href')
                    window.open($link,'')
                })
            })
        </script>
    </head>

    <body>
        <div class="tieude1">Sản phẩm bán chạy</div>
        <div class="noidung">
            <%
                ArrayList<ChiTietSanPhamPOJO> ds = (ArrayList<ChiTietSanPhamPOJO>) request.getAttribute("SanPhamBanChays");
                for (int i = 0; i < ds.size(); i++) {
                    ChiTietSanPhamPOJO ctsp = ds.get(i);
            %>
            <div class="box">
                <div id="main_phim1">
                    <div>                        
                        <img src="<%=ctsp.getHinh()%>"/>                              
                        <div class="name"><a href="ChiTietController?Action=<%=(String) request.getAttribute("LoaiSanPhams")%>&idchitietsanpham=<%=ctsp.getIdchitietsanpham()%>"><%=ctsp.getTensanpham()%></a></div>
                        <div class="info">
                            <p>
                                <span><%=ctsp.getTensanpham()%></span>
                            </p>
                            <p>Giới thiệu:
                                <span> <%=ctsp.getMota()%></span>
                            </p>
                        </div> 
                        <a href="ChiTietController?Action=<%=(String) request.getAttribute("LoaiSanPhams")%>&idchitietsanpham=<%=ctsp.getIdchitietsanpham()%>"></a> 
                    </div>
                </div>
                <div class="gia">Giá:<%=ctsp.getGiaban()%> VNĐ</div>
            </div>
            <% }%>
        </div>

    </body>

</html>
